package com.csmp.service.impl;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.csmp.service.BaseService;

public class BaseServiceImpl extends HibernateDaoSupport implements BaseService {

	public void save(Collection entities,String hql) {
		getSession().createQuery(hql).executeUpdate();
		getHibernateTemplate().saveOrUpdateAll(entities);
	}

	public void del(Object entity) {
		getHibernateTemplate().delete(entity);
	}

	public List<Object> search(String hql) {
		List<Object> list=getHibernateTemplate().find(hql);
		return list;
	}

	public Object loObject(Class objClass, Serializable id) {
		return getHibernateTemplate().load(objClass, id);
	}

}
